package day4;

import java.util.Scanner;

/**
 * @author oldliu
 * @since 1.0
 */
public class CalcScore2 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        double sum = 0;
        //第二种做法
        for (int i = 0; i < 5; i++) {
            System.out.printf("输入一个成绩：");
            double s = in.nextDouble();
            if (s < 0) {
                System.out.println("你输入错误了@");
                break;
            }
            sum += s;
            //里面计算平jun分
            if(i==4){
                double avg = sum / 5;
                System.out.println("平均分：" + avg);
            }

        }


    }
}
